home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / go_away_fly.swf / scripts / frame_265 / DoAction.as < prev   
Text File  |  2007-09-27  |  4KB  |  183 lines

  1. function setting_game()
  2. {
  3.    pos = random(4);
  4.    trace(level + "δáêδ▓¿∞¥┤∞ûæ??");
  5.    var bug_num = 0;
  6.    while(bug_num <= total_num)
  7.    {
  8.       duplicateMovieClip("bug","bug" + bug_num,16384 + bug_num);
  9.       eval("bug" + bug_num).gotoAndStop(2);
  10.       trace(eval("position" + (temp_list[bug_num] - 1)));
  11.       eval("bug" + bug_num)._x = eval("position" + (temp_list[bug_num] - 1)).Xpos;
  12.       eval("bug" + bug_num)._y = eval("position" + (temp_list[bug_num] - 1)).Ypos;
  13.       bug_num++;
  14.    }
  15. }
  16. function gun_fire()
  17. {
  18.    bullet_num++;
  19.    attachMovie("bullet","bullet" + bullet_num,bullet_num);
  20.    var my_fire = eval("bullet" + bullet_num);
  21.    my_fire._x = xpos;
  22.    my_fire._y = dooly._y - 65;
  23.    my_fire.hit_test = function()
  24.    {
  25.       this.onEnterFrame = function()
  26.       {
  27.          this._y -= 30;
  28.          if(this._y <= 200)
  29.          {
  30.             this.onEnterFrame = function()
  31.             {
  32.                this._y -= 30;
  33.                if(this._y <= -10)
  34.                {
  35.                   delete this.onEnterFrame;
  36.                   this.removeMovieClip();
  37.                }
  38.                var bug_num = 2 + Number(this._parent.level);
  39.                while(bug_num >= 0)
  40.                {
  41.                   var what = eval("this._parent.bug" + bug_num);
  42.                   if(this.hitTest(what))
  43.                   {
  44.                      what.gotoAndStop(4);
  45.                      what._name = "delete" + what;
  46.                      this.removeMovieClip();
  47.                      break;
  48.                   }
  49.                   bug_num--;
  50.                }
  51.             };
  52.          }
  53.       };
  54.    };
  55.    my_fire.hit_test();
  56. }
  57. function bug_boom(x2pos, y2pos)
  58. {
  59.    bug_bomb++;
  60.    attachMovie("bomb","bomb" + bug_bomb,bug_bomb);
  61.    var what = eval("bomb" + bug_bomb);
  62.    what._x = x2pos;
  63.    what._y = y2pos;
  64.    what.hit_test = function()
  65.    {
  66.       this.onEnterFrame = function()
  67.       {
  68.          this._y += 15;
  69.          if(this._y >= 360)
  70.          {
  71.             this.onEnterFrame = function()
  72.             {
  73.                this._y += 15;
  74.                if(this._y >= 500)
  75.                {
  76.                   delete this.onEnterFrame;
  77.                   this.removeMovieClip();
  78.                }
  79.                if(this.hitTest(this._parent.dooly.hitted) && this._parent.key.zState == false)
  80.                {
  81.                   this._parent.dooly.gotoAndStop(3);
  82.                   delete this.onEnterFrame;
  83.                   this.removeMovieClip();
  84.                }
  85.             };
  86.          }
  87.       };
  88.    };
  89.    what.hit_test();
  90. }
  91. function ai_test(name_s)
  92. {
  93.    xpos_sub = random(3);
  94.    ypos_sub = random(3);
  95.    var bugs_xpos;
  96.    var bugs_ypos;
  97.    if(xpos_sub == 0)
  98.    {
  99.       if(name_s._x >= 90)
  100.       {
  101.          bugs_xpos = name_s._x - 50;
  102.       }
  103.       else
  104.       {
  105.          bugs_xpos = name_s._x;
  106.       }
  107.    }
  108.    else if(xpos_sub == 1)
  109.    {
  110.       bugs_xpos = name_s._x;
  111.    }
  112.    else if(xpos_sub == 2)
  113.    {
  114.       if(name_s._x <= 680)
  115.       {
  116.          bugs_xpos = name_s._x + 50;
  117.       }
  118.       else
  119.       {
  120.          bugs_xpos = name_s._x;
  121.       }
  122.    }
  123.    if(ypos_sub == 0)
  124.    {
  125.       if(name_s._y >= 90)
  126.       {
  127.          bugs_ypos = name_s._y - 50;
  128.       }
  129.       else
  130.       {
  131.          bugs_ypos = name_s._y;
  132.       }
  133.    }
  134.    else if(ypos_sub == 1)
  135.    {
  136.       bugs_ypos = name_s._y;
  137.    }
  138.    else if(ypos_sub == 2)
  139.    {
  140.       if(name_s._y + 50 <= 140)
  141.       {
  142.          bugs_ypos = name_s._y + 50;
  143.       }
  144.       else
  145.       {
  146.          bugs_ypos = name_s._y;
  147.       }
  148.    }
  149.    name_s.onEnterFrame = function()
  150.    {
  151.       this._x += (bugs_xpos - this._x) / 7;
  152.       this._y += (bugs_ypos - this._y) / 7;
  153.       if(this._x == bugs_xpos and this._y == bugs_ypos)
  154.       {
  155.          delete this.onEnterFrame;
  156.       }
  157.    };
  158. }
  159. function nice_shot()
  160. {
  161.    bugs_hits++;
  162.    trace(bugs_hits + "δºê리 ∞áä∞é¼");
  163.    if(bugs_hits == total_num + 1)
  164.    {
  165.       if(level == 6)
  166.       {
  167.          play();
  168.       }
  169.       else
  170.       {
  171.          gotoAndPlay(264);
  172.       }
  173.    }
  174. }
  175. var bullet_num = 20;
  176. var xpos;
  177. var ypos;
  178. var bug_bomb = 500;
  179. var bugs_hits = 0;
  180. level_num.gotoAndStop(level + 1);
  181. var total_num = level + 2;
  182. trace(total_num + 1 + "δºê리δôñ δéÿ∞ÖÇδ¥╝");
  183.